import { assertEquals } from '@std/assert';
import ArrayList from './ArrayList.ts';
import LinkedQueue from './LinkedQueue.ts';

Deno.test(function ArrayListTest() {
    const list = new ArrayList<number>(4);
    assertEquals(list.size(), 0);

    list.add(1);
    list.add(2);
    assertEquals(list.size(), 2);

    const removed = list.removeAt(0);
    assertEquals(removed, 1);

    const index = list.indexOf(2);
    assertEquals(index, 0);
});

Deno.test(function LinkedQueueTest() {
    const queue = new LinkedQueue<number>();
    assertEquals(queue.size(), 0);

    queue.enqueue(1);
    queue.enqueue(2);
    assertEquals(queue.size(), 2);

    const first = queue.dequeue();
    assertEquals(first, 1);

    const second = queue.dequeue();
    assertEquals(second, 2);
});
